// Author: wsfuyibing <682805@qq.com>
// Date: 2025-05-01

package authorizer

import (
	"server/app/http/models"
	"server/app/kind"
	"time"
)

type Authentication struct {
	// UserId
	// 用户ID号.
	UserId kind.UserId

	// Mobile
	// 用户手机号.
	//
	// 已经过模糊处理的手机号, 如 139****3721.
	Mobile string

	// Nickname
	// 用户昵称.
	Nickname string

	// Issue
	// 令牌颁发时间.
	Issue string
}

func NewAuthentication(user *models.Users) *Authentication {
	return &Authentication{
		UserId:   user.Id,
		Issue:    time.Now().Format(time.DateTime),
		Mobile:   user.Mobile.Mask(),
		Nickname: user.Nickname,
	}
}
